package com.example.chenxiaojun.encryptiondemo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Base64;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
    TextView en;
    TextView de;
private String data="暗黑火焰使";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
en= (TextView) findViewById(R.id.en);
        de= (TextView) findViewById(R.id.de);

        byte[] encode = Base64.encode(data.getBytes(), Base64.DEFAULT);
        en.setText(new String(encode));
        String destr="a2lzc3Nob3QgYWNlcm9sYW9yaW9uIGhlYXJ0dW5kZXIgYmxhZGU=";
        byte[] decode = Base64.decode(destr.getBytes(), Base64.DEFAULT);
        de.setText(new String(decode));

    }
}
